package org.jf.tool.fx.jftoolfx.help.controller;

import javafx.scene.control.ButtonType;
import javafx.scene.control.Dialog;
import javafx.scene.control.TextArea;
import javafx.scene.layout.VBox;
import org.jf.tool.fx.jftoolfx.common.BaseController;

import java.net.URL;
import java.util.ResourceBundle;

/**
 * @author jifeng_zhang
 * @date 2025/8/14 下午6:12
 */
public class AboutController extends BaseController {

    @Override
    protected void init(URL url, ResourceBundle resourceBundle) {

    }

    public void show() {
        // 创建自定义对话框
        Dialog<String> dialog = new Dialog<>();
        dialog.setTitle("版本说明");
        dialog.initOwner(TOP_STAGE);
        dialog.getDialogPane().getButtonTypes().addAll(ButtonType.CANCEL);

        // 创建 TextArea
        TextArea textArea = new TextArea();
        textArea.setWrapText(true);
        textArea.setPrefSize(500, 400);
        textArea.setText(getVersionInfo());

        dialog.getDialogPane().setContent(textArea);
        // 显示对话框并处理结果
        dialog.showAndWait();
    }

    private static String getVersionInfo() {
        StringBuilder sb = new StringBuilder();
        sb.append("v1.0").append("\n");
        sb.append("发布时间：2024-07-03").append("\n");
        sb.append("首发版本，采用jdk22，javafx开发！").append("\n");
        return sb.toString();
    }
}
